home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Knitting.iso / App / Patterns.dxr / behaviors_61_Open Movie in a Window.ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  4.3 KB  |  111 lines

  1. property windowLeft, windowTop, windowWidth, windowHeight, windowMovie, windowName, windowType, scrollable, sizable, zoomable, invisible, whichevent, mark
  2.  
  3. on initOpenMIAW me
  4.   init(me)
  5. end
  6.  
  7. on mouseUp me
  8.   if whichevent = #mouseUp then
  9.     init(me)
  10.   end if
  11.   window(windowName).title = mark
  12. end
  13.  
  14. on prepareFrame me
  15.   if whichevent = #prepareFrame then
  16.     init(me)
  17.   end if
  18. end
  19.  
  20. on exitFrame me
  21.   if whichevent = #exitFrame then
  22.     init(me)
  23.   end if
  24. end
  25.  
  26. on init me
  27.   w = get_previous_instance(the windowList, me.windowName)
  28.   if objectp(w) then
  29.     forget(w)
  30.   end if
  31.   if me.windowName <> EMPTY then
  32.     w = window(me.windowName)
  33.     w.titleVisible = 1
  34.   else
  35.     w = window("temp")
  36.     w.titleVisible = 0
  37.   end if
  38.   w.fileName = get_filename(me.windowMovie)
  39.   w.windowType = get_window_style(me)
  40.   w.rect = rect(the stageLeft, the stageTop, the stageLeft + 640, the stageTop + 480)
  41.   put w.rect
  42.   open(w)
  43. end
  44.  
  45. on get_previous_instance w_list, w_name
  46.   i = count(w_list)
  47.   repeat while i >= 1
  48.     w = getAt(w_list, i)
  49.     if w.name = w_name then
  50.       return w
  51.     end if
  52.     i = -1 + i
  53.   end repeat
  54.   return -1
  55. end
  56.  
  57. on get_window_style me
  58.   case me.windowType of
  59.     #Document:
  60.       if me.zoomable then
  61.         if me.sizable then
  62.           t = 8
  63.         else
  64.           t = 12
  65.         end if
  66.       else
  67.         if me.sizable then
  68.           t = 0
  69.         else
  70.           t = 4
  71.         end if
  72.       end if
  73.     #palette:
  74.       t = 49
  75.     #Rounded:
  76.       t = 16
  77.     #plain:
  78.       t = 2
  79.     #shadow:
  80.       t = 3
  81.     "Modal Dialog":
  82.       t = 1
  83.     "Movable Modal Dialog":
  84.       t = 5
  85.     otherwise:
  86.       t = 4
  87.   end case
  88.   return t
  89. end
  90.  
  91. on get_filename f_name
  92.   if not (f_name contains ".dir") then
  93.     f_name = f_name & ".dir"
  94.   end if
  95.   if (f_name contains "/") or (f_name contains "\") then
  96.     if not f_name contains ":" then
  97.       f_name = the pathname & f_name
  98.     end if
  99.   end if
  100.   return f_name
  101. end
  102.  
  103. on getPropertyDescriptionList
  104.   p_list = [#windowMovie: [#comment: "Movie Name:", #format: #string, #default: EMPTY], #windowName: [#comment: "Window Name:", #format: #string, #default: EMPTY], #windowType: [#comment: "Window Style:", #format: #symbol, #range: [#Document, #palette, #Rounded, #plain, #shadow, "Modal Dialog", "Movable Modal Dialog"], #default: #Document], #sizable: [#comment: "Resize Box:", #format: #boolean, #default: 0], #windowLeft: [#comment: "Left:", #format: #integer, #default: 100], #windowTop: [#comment: "Top:", #format: #integer, #default: 100], #windowWidth: [#comment: "Width:", #format: #integer, #default: 0], #windowHeight: [#comment: "Height:", #format: #integer, #default: 0], #zoomable: [#comment: "Zoom Box:", #format: #boolean, #default: 0], #whichevent: [#comment: "Initializing Event:", #format: #symbol, #range: [#mouseUp, #prepareFrame, #exitFrame, #initOpenMIAW], #default: #mouseUp], #mark: [#comment: "Marker:", #format: #string, #default: EMPTY]]
  105.   return p_list
  106. end
  107.  
  108. on getBehaviorDescription
  109.   return "Opens a Director movie in a window of the designated type. This behavior can be triggered by a specified event or by receiving the initOpenMIAW message. If width and height parameters are set to 0 (the default), the movie opens at it's original size." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Movie Name - Enter the file name of the movie to be opened." & RETURN & "ΓÇó Window Name - ( optional ) Enter the label to be displayed in window header, when visible." & RETURN & "ΓÇó Window Style - Choose a border style and interactivity options. The choices are: Document (moveable, sizeable window without a zoom box), Palette (floating palette), Rounded (rounded corners), Plain (plain box, no title bar), Shadowed (plain box with shadow, no title bar), Modal Dialog, and Moveable Modal Dialog " & RETURN & "ΓÇó Resize Box - Turn this option on to make the window resizable when appropriate." & RETURN & "ΓÇó Left, Top - Enter the initial offset ( in pixels ) of the window from the upper left corner of the display." & RETURN & "ΓÇó Width, Height - ( optional ) Enter the initial dimensions ( in pixels ) of the window." & RETURN & "ΓÇó Zoom Box - Turn this option on to add a minimize/maximize button to the title bar when appropriate." & RETURN & "ΓÇó Initializing Event - Choose the event that triggers the behavior. Choose initOpenMIAW to make the behavior run when it receives this message."
  110. end
  111.